package com.yochi.pictureseditor.effects.effectsimpl;

import com.yochi.pictureseditor.effects.EffectEnum;
import com.yochi.pictureseditor.effects.EffectMozaic;
import com.yochi.pictureseditor.effects.EffectSequential;
import com.yochi.pictureseditor.effects.filters.FilterEnum;
import com.yochi.pictureseditor.exceptions.NullImageException;
import com.yochi.pictureseditor.images.Image;

public class EffectGradientMozaic extends EffectMozaic {

	public EffectGradientMozaic(Image img) {
		super(img);
	}

	@Override
	public Image apply() throws NullImageException {
		Image image = cutSquare();
		Image i1 = getEffectFactory().buildEffect(EffectEnum.CONTRAST_BOOSTER, image).apply();
		Image i2 = image;
		EffectSequential sequence = (EffectSequential) getEffectFactory().buildEffect(EffectEnum.SEQUENTIAL, image);
		sequence.addEffect(getEffectFactory().buildEffect(FilterEnum.SHINE, image));
		Image i3 = sequence.apply();
		sequence.addEffect(getEffectFactory().buildEffect(FilterEnum.SHINE, image));
		Image i4 = sequence.apply();
		image = process(i1, i2, i3, i4);
		return image;
	}
	
	@Override
	public String toString() {
		return "[EffectGradientMozaic]";
	}

}
